<template>
  <div class="cash-out table-theme">
    <head-title title="合作--申请提现"></head-title>
    <el-card>
      <div class="top-menu">
        <div class="menu-left">
          <select-view
            :option-list="typeList"
            :value="type"
            placeholder="类型"
            type="type"
            @value="setSelectValue"
          >
          </select-view>
        </div>
        <div class="menu-right">
          <refresh-button @refresh="refreshPage"></refresh-button>
        </div>
      </div>
      <p class="data-number">总数据数：{{ total }}</p>
      <el-table :data="list">
        <el-table-column
          label="序号"
          align="center"
          prop="customer_id"
          width="50"
        ></el-table-column>
        <el-table-column
          label="用户ID"
          align="center"
          prop="user_id"
        ></el-table-column>
        <el-table-column
          label="名字"
          align="center"
          prop="name"
        ></el-table-column>
        <el-table-column
          label="电话"
          align="center"
          prop="phone"
        ></el-table-column>
        <el-table-column
          label="性别"
          align="center"
          prop="sex"
        ></el-table-column>
        <el-table-column
          label="年龄"
          align="center"
          prop="age"
        ></el-table-column>
        <el-table-column label="预算" align="center">
          <template slot-scope="scope"> <span v-if="scope.row.budget">{{ scope.row.budget }}元</span> </template>
        </el-table-column>
        <el-table-column
          label="类型"
          align="center"
          prop="type_name"
        ></el-table-column>
        <el-table-column
          label="城市"
          align="center"
          prop="city"
        ></el-table-column>
        <el-table-column
          label="户型"
          align="center"
          prop="house"
        ></el-table-column>
        <el-table-column
          label="风格"
          align="center"
          prop="style"
        ></el-table-column>
        <el-table-column
          label="面积"
          align="center"
        >
            <template slot-scope="scope">
                <span v-if="scope.row.area">{{scope.row.area}}m²</span>
            </template>
        </el-table-column>
        <el-table-column
          label="添加时间"
          align="center"
          prop="add_time"
        ></el-table-column>
      </el-table>
      <div class="pages">
        <el-pagination
          background
          layout="prev, pager, next, jumper"
          :total="total"
          @current-change="init"
          :current-page="page"
          :page-size="20"
        ></el-pagination>
      </div>
    </el-card>
  </div>
</template>

<script>
import SelectView from "@/components/SelectView";
export default {
  components: {
    SelectView,
  },
  data() {
    return {
      store_id: localStorage.getItem("store_id"),
      typeList: [
        {
          label: "全部类型",
          value: "",
        },
        {
          label: "面积信息",
          value: 1,
        },
        {
          label: "风格信息",
          value: 2,
        },
        {
          label: "找设计",
          value: 3,
        },
      ],
      type: "",
      list: [],
      total: 0,
      page: 0,
    };
  },
  created() {
    this.init();
  },
  methods: {
    init(e) {
      this.page = e;
      const data = {
        page: e ? e - 1 : 0,
        limit: 20,
        store_id: this.store_id,
        type:this.type
      };
      this.$http(this.$ApiList.CustomerList, data).then((res) => {
        this.list = res.datas.data;
        this.total = res.datas.count;
      });
    },
    refreshPage() {
      this.init();
    },
    setSelectValue(obj) {
      const { type, value } = obj;
      switch (type) {
        case "type":
          this.type = value;
          break;

        default:
          break;
      }
      this.init();
    },
  },
};
</script>

<style lang="scss" scoped>
</style>